<?php
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=Laporan-".$name."");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
header("Pragma: public");
?>
<table>
	<thead>
		<tr>
			<th>NIS</th>
			<th>Nama</th>
			<th>Kelas</th>
			<th>Nilai</th>
			<th>Status</th>
		</tr>
	</thead>
	<tbody>
		<?php foreach ($rows as $row){?>
		<tr>
			<td><?php echo $row->sw_nis;?></td>
			<td><?php echo $row->sw_name;?></td>
			<td><?php echo $row->kl_name?></td>
			<td><?php echo isset($row->nilai)?$row->nilai:'0';?></td>
			<td>
				<?php 
					if(!isset($row->nilai)) echo 'Gagal';
					elseif($row->nilai >= $row->mp_passgrade) echo 'Lulus';
					else echo 'Gagal';
				?>
			</td>
		</tr>
		<?php }?>
	</tbody>
</table>
<?php
session_write_close();
exit;
?>
